//https://www.luogu.com.cn/problem/P1919

//1<=a,b<=10^1000000
#include<cstdint>
#include<vector>
#include<string>
#include<iostream>

const int BITS_PER_INT=9;
const uint32_t LIM_1e9=1000000000;
constexpr bool have_promote(uint32_t num){return num>=LIM_1e9;}
constexpr uint32_t rest(uint32_t num){return num%LIM_1e9;}
struct BigInt{
	std::vector<uint32_t> data;
	BigInt()=default;
	BigInt(const std::string& str);
};

BigInt operator+(const BigInt&l,const BigInt&r){
	BigInt res;
	res.data.resize(std::max(l.data.size(),r.data.size()));
	if(l.data.size() < r.data.size()){
	}
	const size_t ls=l.data.size(),rs=r.data.size();
	auto pres=res.data.begin();uint32_t promote=0;
	auto pl=l.data.begin(),pr=r.data.begin();

	for(;pl!=l.data.end() && pr!=r.data.end();++pl,++pr,++pres){
		uint32_t temp=*pl+*pr+promote;
		if(have_promote(temp)){
			promote=1;
			*pres=rest(temp);
		}
		else{
			promote=0;
			*pres=temp;
		}
	}

	using CIter=std::vector<uint32_t>::const_iterator;
	const auto copy_remained_things=[&promote,&pres](CIter iter,CIter end){
		for(;iter!=end;++iter,++pres){
			uint32_t temp=*iter+promote;
			if(temp==LIM_1e9){
				promote=1;
				*pres=0;
			}
			else{
				*pres=temp;
				++iter;++pres;
				break;
			}
		}
		for(;iter != end;++iter, ++pres) {
			*pres = *iter;
		}
	};
	if(ls>rs){
		copy_remained_things(pl,l.data.end());
	}
	else if(rs>ls){
		copy_remained_things(pr,r.data.end());
	}

	if(promote == 1) {
		res.data.push_back(1);
	}
	return res;
};

BigInt::BigInt(const std::string& str){
	const auto my_rend=str.begin()-1;
	using CITer=std::string::const_iterator;
	//含左含右
	const auto str_pp_to_int=[](CITer l,CITer r)->uint32_t{
		uint32_t res=*l -'0';++l;
		while(l<=r){
			res=res*10+ (*l-'0');
			++l;
		}
		return res;
	};

	for(auto pr=str.end()-1;pr>=my_rend;pr-=9){
		auto pl=pr-8;
		if(pl>my_rend){
			data.push_back(str_pp_to_int(pl,pr));
		}
		else{
			data.push_back(str_pp_to_int(my_rend+1,pr));
		}
	}
}

std::ostream& operator<<(std::ostream& os,const BigInt num){
	char buf[10];buf[9]='\0';
	const auto int_to_strbuf=[&buf](int num){
		for(int i=0;i<9;++i){
			buf[8-i]='0' +(num%10);
			num/=10;
		}
	};
	auto ri=num.data.rbegin();
	os<<*ri;++ri;
	for(;ri!=num.data.rend();++ri){
		int_to_strbuf(*ri);
		os<< buf;
	}

	return os;
}

int main(){
	using namespace std;
	string sA="1000000000000000000000000000000000000000000001";
	string sB="9999999999999999999999999999999999999999999999";
	BigInt A=sA;
	BigInt B=sB;
	cout<<"A= "<<A<<endl;
	cout<<"B= "<<B<<endl;
	BigInt C=A+B;
	cout<<"C= "<<C<<endl;
	return 0;

}